/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package TableModel;

import Entities.Sewa;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Tea-Nose
 */
public class Persewaan_Rekap_TableModel extends AbstractTableModel {

    private List<Sewa> sewas = new ArrayList<Sewa>();

    public Persewaan_Rekap_TableModel(List<Sewa> sewas) {
        this.sewas = sewas;
    }

    public int getRowCount() {
        return sewas.size();

    }

    public int getColumnCount() {
        return 10;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        Sewa sewa = sewas.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return sewa.getNo_faktur();
            case 1:
                return sewa.getNama_penyewa();
            case 2:
                return sewa.getAlamat_penyewa();
            case 3:
                return sewa.getNo_telp_penyewa();
            case 4:
                return sewa.getTanggal_sewa();
            case 5:
                return sewa.getUang_sewa();
            case 6:
                return sewa.getTanggal_kembali();
            case 7:
                return sewa.getDenda();
            case 8:
                return sewa.getNo_Polisi();
            case 9:
                return sewa.getvKeterlambatan();
            default:
                return "";
        }

    }

    @Override
    public String getColumnName(int coloumn) {
        switch (coloumn) {
            case 0:
                return "No Faktur";
            case 1:
                return "Nama Penyewa";
            case 2:
                return "Alamat Penyewa";
            case 3:
                return "No Telp Penyewa";
            case 4:
                return "Tanggal Sewa";
            case 5:
                return "Uang Sewa";
            case 6:
                return "Tanggal Kembali";
            case 7:
                return "Uang Denda";
            case 8:
                return "No Polisi";
            case 9:
                return "Keterlambatan";
            default:
                return "";
        }
    }
}
